import request from '@/utils/request'

// 获取监考列表
export function fetchMonitoringList(params) {
  return request({
    url: '/exam/monitoring/list',
    method: 'get',
    params
  })
}

// 开始监考
export function startMonitoring(examId) {
  return request({
    url: `/exam/monitoring/start/${examId}`,
    method: 'post'
  })
}

// 获取监考记录
export function fetchMonitoringRecords(examId) {
  return request({
    url: `/exam/monitoring/records/${examId}`,
    method: 'get'
  })
}

// 记录监考事件
export function logMonitoringEvent(data) {
  console.log(data);
  return request({
    url: '/monitoring/log',
    method: 'post',
    data: data
  })
}



// 分页查询监考记录
export function getMonitoringLogs(params) {
  return request({
    url: '/monitoring/page',
    method: 'get',
    params: params
  })
}

// 处理监考事件
export function handleMonitoringEvent(logId, result) {
  return request({
    url: `/monitoring/handle/${logId}`,
    method: 'post',
    data: { result }
  })
}

// 获取考试组下的考试列表
export function getGroupExams(groupId) {
  return request({
    url: `/exam/group/${groupId}/exams`,
    method: 'get'
  })
}

// 获取考试组下的成员列表
export function getGroupMembers(groupId) {
  return request({
    url: `/exam/group/${groupId}/members`,
    method: 'get'
  })
}
